  var id = getvl("id");
    var sid = getvl("sid");
 $(function(){
	 var ids=sessionStorage.getItem('idd');
	 var sids=sessionStorage.getItem('sidd');
	 console.log(ids,sids)
 	   if(ids!=''){
 	   	 //selectGoodsList21();
 	   	 shulaing(ids,sids);
 	   	 //pingjai2();
 	   	   //shulaing();
 	   }else if(sid!=""){
 	   //	shulaing();
 	   		// pingjai33();
 	   	 selectGoodsList21();
 	   }
 });
        
        
        /*replymessageList*/
        
        
var currentPage1 = 1;
var currentPage2 = 1;
var currentPage3 = 1;
var currentPage4 = 1;
var currentPage5 = 1;
var ss=0;
var ss2=0;
var ss3=0;
var ss4=0;
var ss5=0;


function selectGoodsList21(){
	if(currentPage1==1 || currentPage1==2 ||ss!=0){
		 ss2=0;
ss3=0;
 ss4=0;
 ss5=0;
 currentPage2 = 1;
 currentPage3 = 1;
currentPage4 = 1;
 currentPage5 = 1;
     $("#leirong2").html("");
       $("#leirong3").html("");
          $("#leirong5").html("");
         $("#leirong4").html("");
		$.ajax({
 url: urlcore + '/api/comment/selectAllComment?current='+currentPage1+'&goodsId='+id+"&type=13&shopId="+sid,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
					ss=data.data.length;
					  $.each(data.data, function(y,n) {
					  	 var leirong='<div class="sell_pingjia1">'+
	    	'<div class="sell_pingjia_xinxi">'+
	    		'<div class="sell_pingjia_tu">'+
	    			'<img onerror="errorImg(this)" src="'+n.user.headImg+'" />'+
	    		'</div>'+
	    	'<div class="sell_pingjia_wenzi">'+
	    			'<div class="sell_pingjia_mz clearfix">'+
	    				'<h5>'+n.user.userName+'</h5>'+
	    				'<div class="fr">';
	    				var sn=0;
	    				for(var i=0;i<n.qualityLevel;i++){
	    					leirong+='<img src="images/star.png" />';
	    					sn++;
	    				}
	    				
	    								for(var i=0;i<5-n.qualityLevel;i++){
	    					leirong+='<img src="images/xin2.png" />';
	    				}
							leirong+='<i>'+sn+'.0分</i>'+
	    				'</div>'+
	    			'</div>';
	    			leirong+='<span>'+n.gmtDatetime+'</span>';
	    			if(n.commentContent!=null){
	    				leirong+='<p>'+n.commentContent+'</p>';
	    			}else{
	    				leirong+='<p></p>';
	    			}
	    			
	    		
	    			if(n.isImg!=0){
	    				leirong+='<div class="sell_pingjia_img clearfix">';
	    			var attachmentUrl1 = n.commentImg;
					if(attachmentUrl1 != null && attachmentUrl1 != '') {
						var imgarr1 = attachmentUrl1.split("***");
						$.each(imgarr1, function(index, value) {
     leirong+='<img onerror="errorImg(this)" src="'+value+'" data-preview-src="" data-preview-group="1" />';
						});
					}
	    			leirong+='</div>';
	    			}
	    		leirong+='</div>'+
	    	'</div>'+
    	'</div>';
    	   $("#leirong").append(leirong);
					  });
				} else if(data.code == 'OVERTIME') {
					var thisUrl = window.location.href;
					alert(thisUrl);
					if(thisUrl.indexOf('1.0.0denglu.html') <= -1) {
						top.window.location.href = "1.0.0denglu.html";
					}

				} else {
					if(data.msg != '空数据') {
						alert(data.msg)
					} else {
						$('#thiscount').text(0);
					}
				}

			},
			error: function() {
				alert("error");
			}
		});
	}
}




function selectGoodsList22(){
	if(currentPage2==1 || currentPage2==2 ||ss2!=0){
		 ss=0;
ss3=0;
 ss4=0;
 ss5=0;
 currentPage1 = 1;

 currentPage3 = 1;
currentPage4 = 1;
 currentPage5 = 1;
     $("#leirong").html("");
       $("#leirong3").html("");
          $("#leirong5").html("");
         $("#leirong4").html("");
		$.ajax({
 url: urlcore + '/api/comment/selectAllComment?current='+currentPage2+'&goodsId='+id+"&type=1&shopId="+sid,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {

					ss2=data.data.length;
					  $.each(data.data, function(y,n) {
					  	 var leirong='<div class="sell_pingjia1">'+
	    	'<div class="sell_pingjia_xinxi">'+
	    		'<div class="sell_pingjia_tu">'+
	    			'<img onerror="errorImg(this)" src="'+n.user.headImg+'" />'+
	    		'</div>'+
	    	'<div class="sell_pingjia_wenzi">'+
	    			'<div class="sell_pingjia_mz clearfix">'+
	    				'<h5>'+n.user.userName+'</h5>'+
	    				'<div class="fr">';
	    				var sn=0;
	    				for(var i=0;i<n.qualityLevel;i++){
	    					leirong+='<img src="images/star.png" />';
	    					sn++;
	    				}
	    				
	    					for(var i=0;i<5-n.qualityLevel;i++){
	    					leirong+='<img src="images/xin2.png" />';
	    				}
							leirong+='<i>'+sn+'.0分</i>'+
	    				'</div>'+
	    			'</div>';
	    		leirong+='<i>'+sn+'.0分</i>'+
	    				'</div>'+
	    			'</div>';
	    			leirong+='<span>'+n.gmtDatetime+'</span>';
	    			if(n.commentContent!=null){
	    				leirong+='<p>'+n.commentContent+'</p>';
	    			}else{
	    				leirong+='<p></p>';
	    			}
	    			
	    		
	    			if(n.isImg!=0){
	    				leirong+='<div class="sell_pingjia_img clearfix">';
	    			var attachmentUrl1 = n.commentImg;
					if(attachmentUrl1 != null && attachmentUrl1 != '') {
						var imgarr1 = attachmentUrl1.split("***");
						$.each(imgarr1, function(index, value) {
     leirong+='<img onerror="errorImg(this)" src="'+value+'" data-preview-src="" data-preview-group="1" />';
						});
					}
	    			leirong+='</div>';
	    			}
	    		leirong+='</div>'+
	    	'</div>'+
    	'</div>';
    	   $("#leirong2").append(leirong);
					  });
			

			} else if(data.code == 'OVERTIME') {
					var thisUrl = window.location.href;
					alert(thisUrl);
					if(thisUrl.indexOf('1.0.0denglu.html') <= -1) {
						top.window.location.href = "1.0.0denglu.html";
					}

				} else {
					if(data.msg != '空数据') {
						alert(data.msg)
					} else {
						$('#thiscount').text(0);
					}
				}

			},
			error: function() {
				alert("error");
			}
		});
	}
	
}






function selectGoodsList23(){
	if(currentPage3==1 || currentPage3==2 ||ss3!=0){
		 ss=0;
ss2=0;
 ss4=0;
 ss5=0;
 currentPage1 = 1;

 currentPage2 = 1;
currentPage4 = 1;
 currentPage5 = 1;
     $("#leirong").html("");
       $("#leirong2").html("");
          $("#leirong5").html("");
         $("#leirong4").html("");
		$.ajax({
 url: urlcore + '/api/comment/selectAllComment?current='+currentPage3+'&goodsId='+id+"&type=2&shopId="+sid,
				type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
					ss3=data.data.length;
					  $.each(data.data, function(y,n) {
					  	 var leirong='<div class="sell_pingjia1">'+
	    	'<div class="sell_pingjia_xinxi">'+
	    		'<div class="sell_pingjia_tu">'+
	    			'<img onerror="errorImg(this)" src="'+n.user.headImg+'" />'+
	    		'</div>'+
	    	'<div class="sell_pingjia_wenzi">'+
	    			'<div class="sell_pingjia_mz clearfix">'+
	    				'<h5>'+n.user.userName+'</h5>'+
	    				'<div class="fr">';
	    				var sn=0;
	    				for(var i=0;i<n.qualityLevel;i++){
	    					leirong+='<img src="images/star.png" />';
	    					sn++;
	    				}
	    				
	    					for(var i=0;i<5-n.qualityLevel;i++){
	    					leirong+='<img src="images/xin2.png" />';
	    				}
					leirong+='<i>'+sn+'.0分</i>'+
	    				'</div>'+
	    			'</div>';
	    			leirong+='<span>'+n.gmtDatetime+'</span>';
	    			if(n.commentContent!=null){
	    				leirong+='<p>'+n.commentContent+'</p>';
	    			}else{
	    				leirong+='<p></p>';
	    			}
	    			
	    		
	    			if(n.isImg!=0){
	    				leirong+='<div class="sell_pingjia_img clearfix">';
	    			var attachmentUrl1 = n.commentImg;
					if(attachmentUrl1 != null && attachmentUrl1 != '') {
						var imgarr1 = attachmentUrl1.split("***");
						$.each(imgarr1, function(index, value) {
     leirong+='<img onerror="errorImg(this)" src="'+value+'" data-preview-src="" data-preview-group="1" />';
						});
					}
	    			leirong+='</div>';
	    			}
	    		leirong+='</div>'+
	    	'</div>'+
    	'</div>';
    	   $("#leirong3").append(leirong);
					  });
				} else if(data.code == 'OVERTIME') {
					var thisUrl = window.location.href;
					alert(thisUrl);
					if(thisUrl.indexOf('1.0.0denglu.html') <= -1) {
						top.window.location.href = "1.0.0denglu.html";
					}

				} else {
					if(data.msg != '空数据') {
						alert(data.msg)
					} else {
						$('#thiscount').text(0);
					}
				}

			},
			error: function() {
				alert("error");
			}
		});
	}
	
}





function selectGoodsList24(){
	if(currentPage4==1 || currentPage4==2 ||ss4!=0){
		 ss=0;
ss2=0;
 ss3=0;
 ss5=0;
 currentPage1 = 1;

    currentPage2 = 1;
     currentPage3 = 1;
        currentPage5 = 1;
     $("#leirong").html("");
       $("#leirong3").html("");
          $("#leirong5").html("");
         $("#leirong2").html("");
		$.ajax({
 url: urlcore + '/api/comment/selectAllComment?current='+currentPage4+'&goodsId='+id+"&type=3&shopId="+sid,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
					ss4=data.data.length;
					  $.each(data.data, function(y,n) {
					  	 var leirong='<div class="sell_pingjia1">'+
	    	'<div class="sell_pingjia_xinxi">'+
	    		'<div class="sell_pingjia_tu">'+
	    			'<img onerror="errorImg(this)" src="'+n.user.headImg+'" />'+
	    		'</div>'+
	    	'<div class="sell_pingjia_wenzi">'+
	    			'<div class="sell_pingjia_mz clearfix">'+
	    				'<h5>'+n.user.userName+'</h5>'+
	    				'<div class="fr">';
	    				var sn=0;
	    				for(var i=0;i<n.qualityLevel;i++){
	    					leirong+='<img src="images/star.png" />';
	    					sn++;
	    				}
	    					for(var i=0;i<5-n.qualityLevel;i++){
	    					leirong+='<img src="images/xin2.png" />';
	    				}
	    				
					leirong+='<i>'+sn+'.0分</i>'+
	    				'</div>'+
	    			'</div>';
	    			leirong+='<span>'+n.gmtDatetime+'</span>';
	    			if(n.commentContent!=null){
	    				leirong+='<p>'+n.commentContent+'</p>';
	    			}else{
	    				leirong+='<p></p>';
	    			}
	    			
	    		
	    			if(n.isImg!=0){
	    				leirong+='<div class="sell_pingjia_img clearfix">';
	    			var attachmentUrl1 = n.commentImg;
					if(attachmentUrl1 != null && attachmentUrl1 != '') {
						var imgarr1 = attachmentUrl1.split("***");
						$.each(imgarr1, function(index, value) {
     leirong+='<img onerror="errorImg(this)" src="'+value+'" data-preview-src="" data-preview-group="1" />';
						});
					}
	    			leirong+='</div>';
	    			}
	    		leirong+='</div>'+
	    	'</div>'+
    	'</div>';
    	   $("#leirong4").append(leirong);
					  });
				} else if(data.code == 'OVERTIME') {
					var thisUrl = window.location.href;
					alert(thisUrl);
					if(thisUrl.indexOf('1.0.0denglu.html') <= -1) {
						top.window.location.href = "1.0.0denglu.html";
					}

				} else {
					if(data.msg != '空数据') {
						alert(data.msg)
					} else {
						$('#thiscount').text(0);
					}
				}

			},
			error: function() {
				alert("error");
			}
		});
	}
	
}





function selectGoodsList25(){
	if(currentPage5==1 || currentPage5==2 ||ss5!=0){
		 ss=0;
ss2=0;
 ss3=0;
 ss4=0;
 currentPage1 = 1;

    currentPage2 = 1;
     currentPage3 = 1;
        currentPage4 = 1;
     $("#leirong").html("");
       $("#leirong3").html("");
          $("#leirong4").html("");
         $("#leirong2").html("");
		$.ajax({
 url: urlcore + '/api/comment/selectAllComment?current='+currentPage5+'&goodsId='+id+"&type=4&shopId="+sid,
				type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
					ss5=data.data.length;
					  $.each(data.data, function(y,n) {
					  	 var leirong='<div class="sell_pingjia1">'+
	    	'<div class="sell_pingjia_xinxi">'+
	    		'<div class="sell_pingjia_tu">'+
	    			'<img onerror="errorImg(this)" src="'+n.user.headImg+'" />'+
	    		'</div>'+
	    	'<div class="sell_pingjia_wenzi">'+
	    			'<div class="sell_pingjia_mz clearfix">'+
	    				'<h5>'+n.user.userName+'</h5>'+
	    				'<div class="fr">';
	    				var sn=0;
	    				for(var i=0;i<n.qualityLevel;i++){
	    					leirong+='<img src="images/star.png" />';
	    					sn++;
	    				}
	    					for(var i=0;i<5-n.qualityLevel;i++){
	    					leirong+='<img src="images/xin2.png" />';
	    				}
						leirong+='<i>'+sn+'.0分</i>'+
	    				'</div>'+
	    			'</div>';
	    			leirong+='<span>'+n.gmtDatetime+'</span>';
	    			if(n.commentContent!=null){
	    				leirong+='<p>'+n.commentContent+'</p>';
	    			}else{
	    				leirong+='<p></p>';
	    			}
	    			
	    		
	    			if(n.isImg!=0){
	    				leirong+='<div class="sell_pingjia_img clearfix">';
	    			var attachmentUrl1 = n.commentImg;
					if(attachmentUrl1 != null && attachmentUrl1 != '') {
						var imgarr1 = attachmentUrl1.split("***");
						$.each(imgarr1, function(index, value) {
     leirong+='<img onerror="errorImg(this)" src="'+value+'" data-preview-src="" data-preview-group="1" />';
						});
					}
	    			leirong+='</div>';
	    			}
	    		leirong+='</div>'+
	    	'</div>'+
    	'</div>';
    	   $("#leirong5").append(leirong);
					  });
				} else if(data.code == 'OVERTIME') {
					var thisUrl = window.location.href;
					alert(thisUrl);
					if(thisUrl.indexOf('1.0.0denglu.html') <= -1) {
						top.window.location.href = "1.0.0denglu.html";
					}

				} else {
					if(data.msg != '空数据') {
						alert(data.msg)
					} else {
						$('#thiscount').text(0);
					}
				}

			},
			error: function() {
				alert("error");
			}
		});
	}
	
}




function pingjai33(){
		$.ajax({
 url: urlcore + "/api/shopInfo/selectagno1?shopId="+sid,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
				
					  var xing="";
					  	 for(var i=0;i<data.data.serviceLevel;i++){
				           xing+='<img src="images/star.png" />';
					     }
					  	 	for(var i=0;i<5-data.data.serviceLevel;i++){
	    					xing+='<img src="images/xin2.png" />';
	    				}
					  	 			 $("#shopfuwu").append(xing);
					  var wu="";
					  	 for(var i=0;i<data.data.carLevel;i++){
				           wu+='<img src="images/star.png" />';
					     }
					  	  	for(var i=0;i<5-data.data.carLevel;i++){
	    					wu+='<img src="images/xin2.png" />';
	    				}
					  	 	 $("#wuliu").append(wu);
					  	 	 var goodspz2="";
					  	 for(var i=0;i<data.data.qualityLevel;i++){
				           goodspz2+='<img src="images/star.png" />';
					     }
					    	 for(var i=0;i<5-data.data.qualityLevel;i++){
				           goodspz2+='<img src="images/xin2.png" />';
					     }
					 $("#goodspingzhi").append(goodspz2);
					 
					 
					  
				} else if(data.code == 'OVERTIME') {
					var thisUrl = window.location.href;
					alert(thisUrl);
					if(thisUrl.indexOf('1.0.0denglu.html') <= -1) {
						top.window.location.href = "1.0.0denglu.html";
					}
				} else {
					if(data.msg != '空数据') {
						alert(data.msg)
					} else {
						$('#thiscount').text(0);
					}
				}
			},
			error: function() {
				alert("error");
			}
		});
}




function pingjai2(){
		$.ajax({
       url: urlcore + "/api/shopInfo/selectagno1?goodsid="+id,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
				
					  var xing="";
					  	 for(var i=0;i<data.data.serviceLevel;i++){
				           xing+='<img src="images/star.png" />';
					     }
					  	 	for(var i=0;i<5-data.data.serviceLevel;i++){
	    					xing+='<img src="images/xin2.png" />';
	    				}
					  	 			 $("#shopfuwu").append(xing);
					  var wu="";
					  	 for(var i=0;i<data.data.carLevel;i++){
				           wu+='<img src="images/star.png" />';
					     }
					  	  	for(var i=0;i<5-data.data.carLevel;i++){
	    					wu+='<img src="images/xin2.png" />';
	    				}
					  	 	 $("#wuliu").append(wu);
					  	 	 var goodspz2="";
					  	 for(var i=0;i<data.data.qualityLevel;i++){
				           goodspz2+='<img src="images/star.png" />';
					     }
					    	 for(var i=0;i<5-data.data.qualityLevel;i++){
				           goodspz2+='<img src="images/xin2.png" />';
					     }
					 $("#goodspingzhi").append(goodspz2);
					 
					 
					  
				} else if(data.code == 'OVERTIME') {
					var thisUrl = window.location.href;
					alert(thisUrl);
					if(thisUrl.indexOf('1.0.0denglu.html') <= -1) {
						top.window.location.href = "1.0.0denglu.html";
					}
				} else {
					if(data.msg != '空数据') {
						alert(data.msg)
					} else {
						$('#thiscount').text(0);
					}
				}
			},
			error: function() {
				alert("error");
			}
		});
}




function shulaing(ids,sids){
	console.log(ids,sids)
		$.ajax({
      url: urlcore + "/api/comment/selectCount?goodsId="+ids+"&shopId="+sids,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				var ratelv=''
				if(data.success == true) {
					var rate = 100;
        if (data.data.total != 0) {
          rate = parseInt((data.data.hpSize / data.data.total) * 100);
        }
				
				ratelv='<h5>好评率：<span id="quanbu">'+rate+'%</span></h5>';
				$('#haopinglv').append(ratelv)
				
// 					   $("#pingjiashu").html("");
// 					  $("#pingjiashu").html(data.data.total+"条评价");
// 					  var quanbu=data.data.hpSize+'%';
// 					  $("#quanbu").html(quanbu);
// 					// $("#quanbu").html("("+data.data.total+")");
// 					 $("#quanbusss").html("("+data.data.total+")");
//            $("#haoping").html("("+data.data.hpSize+")");
//            $("#zhongping").html("("+data.data.zpSize+")");
//            $("#chapiing").html("("+data.data.cpSize+")");
//           $("#shaitu").html("("+data.data.stSize+")");
					
				} else if(data.code == 'OVERTIME') {
					var thisUrl = window.location.href;
					alert(thisUrl);
					if(thisUrl.indexOf('1.0.0denglu.html') <= -1) {
						top.window.location.href = "1.0.0denglu.html";
					}
				} else {
					if(data.msg != '空数据') {
						alert(data.msg)
					} else {
						$('#thiscount').text(0);
					}
				}
			},
			error: function() {
				alert("error");
			}
		});
}
// 获取评论数
// function findCommentNumber() {
// 		$.ajax({
// 	     url: urlcore + "/api/comment/selectCount?goodsId="+id+"&shopId="+sid,
// 			type: "get",
// 			dataType: 'json',
// 			contentType: "application/json;charset=utf-8",
// 			success: function(data) {
// 				if(data.success == true) {
// 					
// 				}
// 			},
// 		})	
//     var that = this;
//     httpsUtils.getData({
//       _url: app.globalData._url + '/comment/selectCount?goodsId=' + that.data.goodsId + '&shopId=' + that.data.shopId,
//       data: '',
//     }, function (json) {
//       console.log(json)
//       if (json.data && json.success) {
//         var rate = 100;
//         if (json.data.total != 0) {
//           rate = parseInt((json.data.hpSize / json.data.total) * 100);
//         }
//         that.setData({
//           plNum: json.data,
//           hpRate: rate
//         })
//       }
//     })
//   }
